# -*- coding: utf-8 -*-
"""
API v1版本路由

包含所有业务模块的RESTful API接口：
- 用户认证和权限管理
- 客户档案管理
- 邀约活动管理
- 销售机会跟踪
- 产品管理
- 出团管理
- 售后服务
- 数据统计
- 客户分析
- 系统管理
"""

from fastapi import APIRouter

from .auth import router as auth_router
from .rbac import router as rbac_router
from .users import router as users_router
# from .customers import router as customers_router  # 已删除
from .activities import router as activities_router
from .opportunities import router as opportunities_router
from .products import router as products_router
from .tours import router as tours_router
from .aftercare import router as aftercare_router
from .statistics import router as statistics_router
from .analysis import router as analysis_router
from .system import router as system_router

# 创建v1版本的主路由
api_router = APIRouter()

# 注册各模块路由
api_router.include_router(auth_router, prefix="/auth", tags=["认证"])
api_router.include_router(rbac_router, prefix="/rbac", tags=["权限管理"])
api_router.include_router(users_router, prefix="", tags=["用户管理"])  # 直接在根路径下
# api_router.include_router(customers_router, prefix="/customers", tags=["客户管理"])  # 已删除
api_router.include_router(activities_router, prefix="/activities", tags=["邀约活动"])
api_router.include_router(opportunities_router, prefix="/opportunities", tags=["销售机会"])
api_router.include_router(products_router, prefix="/products", tags=["产品管理"])
api_router.include_router(tours_router, prefix="/tours", tags=["出团管理"])
api_router.include_router(aftercare_router, prefix="/aftercare", tags=["售后服务"])
api_router.include_router(statistics_router, prefix="/statistics", tags=["数据统计"])
api_router.include_router(analysis_router, prefix="/analysis", tags=["客户分析"])
api_router.include_router(system_router, prefix="/system", tags=["系统管理"])


@api_router.get("/health")
async def api_health_check():
    """API健康检查"""
    return {
        "status": "healthy",
        "version": "v1",
        "message": "CRM API v1 正常运行"
    }